*** Settings ***
Library           ../../CommonLibs/FDataFactors/DFactors.py
Resource          ../../CommonVars/DataVariables/VOwner.robot
Library           ../../CommonLibs/RobotListeners/TestListener.py
Library           Screenshot
Library           Collections
Library           Selenium2Library
Library           ../../CommonLibs/SeleniumUtils/CustomSeleniumLibrary.py
Resource          ../../CommonOpreators/OpElements/OpTable.robot
Resource          ../../CommonOpreators/OpElements/OpSelect.robot
Library           ../../CommonLibs/FDataFactors/FormatData.py
Library           AutoItLibrary
Library           os
Resource          ../../CommonOpreators/OpElements/OpElements.robot
Resource          ../../CommonOpreators/OpElements/COMM_Dict.robot
Resource          ../../CommonOpreators/OpElements/COMM_STR.robot

*** Variables ***
${upload}         id=upload
&{proposalnolist}

*** Test Cases ***
TGoFunLib
    ${param}=    GetDataOfIdentifyType    ${VIdentifyTypePersonal}[0]
    log    ${param}
    log    ${VIdentifyTypePersonal}[0]
    ${name}=    PersonName
    log    ${name}
    ${phone}=    Phone    15779606784
    log    ${phone}
    ${license}=    GengerLicense
    log    ${license}
    ${Customer}=    CustomLicense    鲁    A
    log    ${Customer}
    Take Screenshot

tersts
    ${formchecknullLabels}=    Set Variable    ['*年龄', '销售公司名称', '销售公司所在地', '是否4S店销售']
    ${VVVVV}=    Split    ${formchecknullLabels}
    ${count}=    CountValuesInList    ${formchecknullLabels}
    log    ${VVVVV}[1]
    FOR    ${i}    IN RANGE    0    ${count}
        log    ${VVVVV}[${i}]
    END
    ${uwCount}=    Set Variable    1
    ${ForceCount} =    Set Variable    1
    ${BusiCount} =    Set Variable    0
    run keyword if    ${uwCount} == 2    log    23232
    ...    ELSE IF    ${uwCount} == 1    run keyword if    ${ForceCount} ==1    log    555555
    ...    ELSE IF    ${BusiCount} == 1    log    66666

math
    ${height_top}    Set Variable    120
    ${height}=    Set Variable    444
    ${height1}=    Evaluate    ${height}-${height_top}
    log    ${height1}
    ${proposalnolist}=    Create Dictionary    '1'=1    '2'=2    '3'=3
    ${items}=    Get Dictionary Items    ${proposalnolist}
    log    ${items}
    ${keys}=    Get Dictionary Keys    ${proposalnolist}
    ${values}=    Get Dictionary Values    ${proposalnolist}
    ${len}=    Get Length    ${proposalnolist}

Kwds
    #${mesg}=    Get Alert Message
    ${dirver}=    Create Webdriver    Chrome
    log    ${dirver}
    GO to    C:\\Users\\Administrator\\Desktop\\js 三种弹框.html
    ${sw1}=    get webdriver instance
    log    ${sw1}
    ${webids}=    Get Browser Ids
    log    ${webids}
    ${aliases}=    Get Browser Aliases
    log    ${aliases}
    #${webdriver}=    Get webdriver instance
    #og    webdriver:${webdriver}
    click element    name=Submit2
    ${boola}=    Alert Should View
    #Alert Should Be Present
    #Alert Should Not Be Present
    #Dismiss Alert

FunTable
    open Browser    C:\\Users\\Administrator\\Desktop\\rule.html    gc
    @{list}=    get table list    //*[@id="table1"]/tbody/tr    //*[@id="table1"]/tbody/tr[1]/td
    ${len}=    Get length    ${list}
    FOR    ${i}    IN RANGE    ${len}
        ${22i}=    Get From List    ${list}    ${i}
        ${len1}=    Get length    ${22i}
        #FOR    ${j}    IN RANGE    ${len1}
        #    ${item}=    Get From List    ${22i}    ${j}
        #    log    ${item}
    #END
        log    ${22i}
    END
    close window

times
    ${time} =    Get Time    year-month-day    NOW
    ${yyyy}    ${mm}    ${dd} =    Get Time    year,month,day
    ${now}=    Evaluate    ''.join("${yyyy}-${mm}-${dd}")
    ${now}    set variable    "${yyyy}-${mm}-${dd}"
    ${now}    set variable    ${yyyy}-${mm}-${dd}
    ${memory}=    Evaluate    random.randint(1000, 200000)
    ${point}=    Evaluate    random.randint(10, 99)
    ${1}=    set variable    ${memory}.${point}
    ${xpath}=    set variable    //*[@id="identifyType_Personal"]/option
    ${var}=    set variable    0
    ${OpXpath}=    catenate    SEPARATOR=    ${xpath}    [${var}]

selectOp
    Open Browser    D:\\Document\\HBuilderProjects\\test.html    gc
    ${values}=    获取下拉列表值    Xpath=//*[@id="identifyType_Personal"]
    log    ${values}
    close Browser

StrFormat
    ${addr}=    set variable    "D:\\Document\\Work\\华安\\REQ-12946 新能源\\img"

Run Win

upload-1
    Open Browser    upload.html    gc
    ${value}=    Get WebElements    ${upload}
    Selenium2Library.Mouse Down    ${upload}
    Selenium2Library.Mouse Up    ${upload}
    sleep    5
    AutoItLibrary.run    upload.exe
    sleep    5

local-vars
    ${cur}=    set variable    ${CURDIR}
    ${out}=    set variable    ${OUTPUTDIR}
    ${abPath}=    reversePath    ${CURDIR}    2
    Set To Dictionary    ${proposalnolist}    '项目路径'    ${abPath}
    ${len}=    Get Length    ${proposalnolist}
    ${keys}=    Get Dictionary Keys    ${proposalnolist}
    ${values}=    Get Dictionary Values    ${proposalnolist}
    FOR    ${i}    IN RANGE    0    ${len}
        ${key}=    set variable    ${keys}[${i}]
        ${projectpath}=    run keyword if    '项目路径' in ${key}    set variable    ${values}[${i}]
        exit for loop if    '项目路径' in ${key}
    END
    log    ${projectpath}

Test-list
    ${lst}    Create list    1    2    3    4
    Is Exist In List    ${lst}    5
    ${Lst1}=    Del In List By Value    ${lst}    2
    ${Lst2}=    Insert In List By Value    ${lst}    3    1121
    ${Lst3}=    Insert In List By Index    ${lst}    0    121212121

DictTest
    &{dict}    Create dictionary    01=身份证    02=护照    03=军人证    05=台胞证    06=港澳通行证    14=外国人永久居留身份证    15=港澳台居民居住证
    log    ${dict}
    ${ret}=    Is Key Exist In Dict    ${dict}    06
    ${ret1}=    Is Val Exist In Dict    ${dict}    护照
    ${ret2}=    Get Value From Dict    ${dict}    06
    ${ret3}=    Update Value From Dict    ${dict}    10    台湾证件
    ${ret4}=    Del Value From Dict    ${dict}    05

Str_test
    ${str}=    set variable    '0171020202'
    ${substr}=    set variable    '0107'
    ${sindex}=    set variable    0
    ${eindex}=    set variable    4
    ${beijig}=    Start_with    ${str}    ${substr}    ${sindex}    ${eindex}
    ${str1}=    set variable    'C:/re/erer/erere/'
    ${srcstr}=    set variable    '/'
    ${dststr}=    set variable    '//'
    ${str1}=    Repalce_str    ${str1}    ${srcstr}    ${dststr}
    ${srcstr}=    set variable    '1'
    ${dststr}=    set variable    '333'
    ${str}=    Repalce_str    ${str}    ${srcstr}    ${dststr}
    ${str4}=    set variable    '6021301030120210000029'
    ${beiji22g}=    Start_with    ${str4}    '6'    0    1
